home *** CD-ROM | disk | FTP | other *** search
/ Gigarom 1 / Gigarom Macintosh Archives (Quantum Leap)(CDRM1080320)(1993).iso / FILES / HYP / C-D / ChooseIcon & CustomFileName.cpt / ChooseIcon & CustomFileName / card_2830.txt < prev    next >
Text File  |  1989-02-26  |  11KB  |  263 lines

  1. -- card: 2830 from stack: in
  2. -- bmap block id: 3218
  3. -- flags: 0000
  4. -- background id: 2791
  5. -- name: 
  6. ----- HyperTalk script -----
  7. on openCard
  8.   set scroll of card field "CustomFileName Doc" to 0
  9.   set scroll of card field "ChooseIcon Doc" to 0
  10. end openCard
  11.  
  12.  
  13. -- part 6 (button)
  14. -- low flags: 00
  15. -- high flags: 2004
  16. -- rect: left=226 top=285 right=338 bottom=287
  17. -- title width / last selected line: 0
  18. -- icon id / first selected line: 5155 / 5155
  19. -- text alignment: 1
  20. -- font id: 0
  21. -- text size: 12
  22. -- style flags: 0
  23. -- line height: 16
  24. -- part name: New Button
  25. ----- HyperTalk script -----
  26. on mouseUp
  27.   show card field "Oscar"
  28. end mouseUp
  29.  
  30.  
  31.  
  32. -- part 1 (field)
  33. -- low flags: 01
  34. -- high flags: 2007
  35. -- rect: left=5 top=95 right=271 bottom=206
  36. -- title width / last selected line: 0
  37. -- icon id / first selected line: 0 / 0
  38. -- text alignment: 0
  39. -- font id: 3
  40. -- text size: 9
  41. -- style flags: 0
  42. -- line height: 12
  43. -- part name: ChooseIcon Doc
  44.  
  45.  
  46. -- part 2 (field)
  47. -- low flags: 01
  48. -- high flags: 2007
  49. -- rect: left=306 top=95 right=271 bottom=507
  50. -- title width / last selected line: 0
  51. -- icon id / first selected line: 0 / 0
  52. -- text alignment: 0
  53. -- font id: 3
  54. -- text size: 9
  55. -- style flags: 0
  56. -- line height: 12
  57. -- part name: CustomFileName Doc
  58.  
  59.  
  60. -- part 4 (button)
  61. -- low flags: 00
  62. -- high flags: 0000
  63. -- rect: left=209 top=95 right=177 bottom=304
  64. -- title width / last selected line: 0
  65. -- icon id / first selected line: 0 / 0
  66. -- text alignment: 1
  67. -- font id: 0
  68. -- text size: 12
  69. -- style flags: 0
  70. -- line height: 16
  71. -- part name: The Bottom Line Button
  72. ----- HyperTalk script -----
  73. on mouseUp
  74.   show card field "The Bottom Line"
  75. end mouseUp
  76.  
  77.  
  78.  
  79. -- part 5 (button)
  80. -- low flags: 00
  81. -- high flags: 0000
  82. -- rect: left=209 top=181 right=254 bottom=304
  83. -- title width / last selected line: 0
  84. -- icon id / first selected line: 0 / 0
  85. -- text alignment: 1
  86. -- font id: 0
  87. -- text size: 12
  88. -- style flags: 0
  89. -- line height: 16
  90. -- part name: Demos
  91. ----- HyperTalk script -----
  92. on mouseUp
  93.   visual effect iris open
  94.   go to second card
  95. end mouseUp
  96.  
  97.  
  98.  
  99. -- part 3 (field)
  100. -- low flags: 81
  101. -- high flags: 2004
  102. -- rect: left=13 top=21 right=338 bottom=500
  103. -- title width / last selected line: 0
  104. -- icon id / first selected line: 0 / 0
  105. -- text alignment: 0
  106. -- font id: 2
  107. -- text size: 12
  108. -- style flags: 256
  109. -- line height: 16
  110. -- part name: The Bottom Line
  111. ----- HyperTalk script -----
  112. on mouseUp
  113.   hide card field "The Bottom Line"
  114. end mouseUp
  115.  
  116.  
  117.  
  118. -- part 7 (field)
  119. -- low flags: 01
  120. -- high flags: 2004
  121. -- rect: left=84 top=53 right=282 bottom=423
  122. -- title width / last selected line: 0
  123. -- icon id / first selected line: 0 / 0
  124. -- text alignment: 0
  125. -- font id: 3
  126. -- text size: 9
  127. -- style flags: 0
  128. -- line height: 12
  129. -- part name: Oscar
  130. ----- HyperTalk script -----
  131. on mouseUp
  132.   hide card field "Oscar"
  133. end mouseUp
  134.  
  135.  
  136.  
  137. -- part 8 (button)
  138. -- low flags: 00
  139. -- high flags: 0000
  140. -- rect: left=333 top=277 right=312 bottom=475
  141. -- title width / last selected line: 0
  142. -- icon id / first selected line: 0 / 0
  143. -- text alignment: 1
  144. -- font id: 0
  145. -- text size: 12
  146. -- style flags: 0
  147. -- line height: 16
  148. -- part name: What's New
  149. ----- HyperTalk script -----
  150. on mouseUp
  151.   show card field "The New"
  152. end mouseUp
  153.  
  154.  
  155.  
  156. -- part 9 (field)
  157. -- low flags: 81
  158. -- high flags: 2004
  159. -- rect: left=231 top=85 right=335 bottom=503
  160. -- title width / last selected line: 0
  161. -- icon id / first selected line: 0 / 0
  162. -- text alignment: 0
  163. -- font id: 3
  164. -- text size: 12
  165. -- style flags: 256
  166. -- line height: 16
  167. -- part name: The New
  168. ----- HyperTalk script -----
  169. on mouseUp
  170.   hide card field "The New"
  171. end mouseUp
  172.  
  173.  
  174. -- part contents for card part 1
  175. ----- text -----
  176.            ChooseIcon XFCN 1.5b1
  177.                      ‚Ä¢‚Ä¢‚Ä¢‚Ä¢‚Ä¢‚Ä¢‚Ä¢
  178.      This HyperCard external function was originally created to help give stack authors more control over the user interactive creation of buttons from scripts.  What!?!? 
  179.                      ‚Ä¢‚Ä¢‚Ä¢‚Ä¢‚Ä¢‚Ä¢‚Ä¢
  180.      ChooseIcon simply puts up a familiar dialog box containing the available icons, and returns the selected icon's ID number. It returns 0 if the user chooses "No Icon" and empty if the user cancels.
  181.                      ‚Ä¢‚Ä¢‚Ä¢‚Ä¢‚Ä¢‚Ä¢‚Ä¢
  182.      It will take two optional parameters. The first is a text string to be placed at the top of the dialog box as a prompt string. The second is a way of restricting the displayed icons to the ones in the current stack only (not the system or HyperCard). A "1"  passed as the second parameter will enable this restriction.
  183.                      ‚Ä¢‚Ä¢‚Ä¢‚Ä¢‚Ä¢‚Ä¢‚Ä¢
  184.      In order for the XFCN to work you need all four of the following resources:
  185. ---------------------------------
  186.     XFCN "ChooseIcon" ID = 11112
  187.     LDEF "ChooseIcon" ID = 12
  188.     DLOG "ChooseIcon" ID = 10057
  189.     DITL "ChooseIcon" ID = 21662
  190. ---------------------------------
  191.                      ‚Ä¢‚Ä¢‚Ä¢‚Ä¢‚Ä¢‚Ä¢‚Ä¢
  192.      If you would like to customize the dialog box, that's fine, just don't change it's ID number, don't remove any items (but you may add text and PICTs, etc.), and DON'T change the size of the user item which displays the icons (very important).
  193.                      ‚Ä¢‚Ä¢‚Ä¢‚Ä¢‚Ä¢‚Ä¢‚Ä¢
  194.      If you want to include a prompt string which is larger than you can pass through HyperTalk, or which contains ICONS or PICTS, you can just paste them with ResEdit over the existing user item  (do not delete it, but you may move it), and then pass an empty string as the prompt parameter so the user item will stay blank.
  195.                      ‚Ä¢‚Ä¢‚Ä¢‚Ä¢‚Ä¢‚Ä¢‚Ä¢
  196.      Please use ChooseIcon with caution, as it is a beta version, not fully tested and in no way guaranteed. Please let me know about any bugs.
  197.  
  198. -- part contents for card part 2
  199. ----- text -----
  200.        CustomFileName XFCN 2.0b1
  201.                      ‚Ä¢‚Ä¢‚Ä¢‚Ä¢‚Ä¢‚Ä¢‚Ä¢
  202.      Poor Steve Maller, he writes a truly elegant piece of work like the FileName XFCN, and then people like me come along and nasty it up with all kinds of stuff that would make Scott Knaster pop out in hives if he disassembled the code.
  203.                      ‚Ä¢‚Ä¢‚Ä¢‚Ä¢‚Ä¢‚Ä¢‚Ä¢
  204.      With that said, CustomFileName is basically the FileName XFCN, i.e., it puts up the standard file dialog box and returns the pathway of the selected file.  It returns empty if the user cancels. You may pass the file Type as the first parameter to restrict the display to files of a given type,e.g., STAK, APPL, etc.  Passing no parameters or a null string allows all file types to be displayed.
  205.                      ‚Ä¢‚Ä¢‚Ä¢‚Ä¢‚Ä¢‚Ä¢‚Ä¢
  206.      The first thing that is different about CustomFileName is that it returns three lines in its result. The first line is the pathway just as in FileName, the second line is the the file Type of the selected file, and the third line is the Creator code. This is useful if your script is creating a button linking to the selected file and you need to know a) is it a document or an application, b) if a document, then what is the creator application, and c) is it a stack?
  207.                      ‚Ä¢‚Ä¢‚Ä¢‚Ä¢‚Ä¢‚Ä¢‚Ä¢
  208.      If you just needed the pathway in your result you would script:
  209.   'put line 1 of CustomFileName()¬¨ ¬†¬†into temp'
  210. This would behave just like FileName.
  211.                      ‚Ä¢‚Ä¢‚Ä¢‚Ä¢‚Ä¢‚Ä¢‚Ä¢
  212.      The next major difference is that CustomFileName can take a second parameter. This is a text string which will appear as a prompt string at the top of the dialog box.
  213.                      ‚Ä¢‚Ä¢‚Ä¢‚Ä¢‚Ä¢‚Ä¢‚Ä¢
  214.      An added feature of Version 2.0b1, suggested by Henry Lowe, is that it will accept a third parameter which should be the name you wish to assign to the OPEN button of the Standard File box. If you omit this parameter or mess up the format, the OPEN button remains as is. The proper format is the name you wish to use followed by a slash followed by the command key eqivalent (you must include one). See sample button    #8 for an example of this.
  215.                      ‚Ä¢‚Ä¢‚Ä¢‚Ä¢‚Ä¢‚Ä¢‚Ä¢
  216.      The final difference is that CustomFileName uses its own DLOG and DITL resources instead of the system's.  Thus you can change the appearance and add your own fancy prompt strings if you like. Don't remove or change any of the existing items though (you can change the size of the whole box and you can paste over the prompt string item).
  217.                      ‚Ä¢‚Ä¢‚Ä¢‚Ä¢‚Ä¢‚Ä¢‚Ä¢
  218.     In order for the XFCN to work you need the three following resources:   
  219. ---------------------------------
  220. XFCN "CustomFileName" ID = 12105
  221. DLOG "CustomFileName" ID = 17654
  222. DITL "CustomFileName" ID = 18134
  223. ---------------------------------
  224.                      ‚Ä¢‚Ä¢‚Ä¢‚Ä¢‚Ä¢‚Ä¢‚Ä¢
  225.      As is the case with ChooseIcon, CustomFileName is a beta version, and not guaranteed to be bug free. Please use it with caution, and let me know of any bugs.
  226.  
  227. -- part contents for card part 3
  228. ----- text -----
  229. Two XFCN's. Particularly useful for Finder replacements, but there are undoubtedly other applications.
  230.  
  231. ChooseIcon:
  232. Puts up a dialog box with icons displayed (like button info 'Icon' button) and returns icon id. Returns empty if cancelled, 0 if user chooses "No Icon." Two optional parameters, first is any prompt string to be displayed, 2nd is "1" if you want to display only the current stack's icons.
  233.  
  234. CustomFileName:
  235. Just like FileName only returns three lines in result:
  236.      1) The pathway (just like FileName).
  237.      2) The file Type
  238.      3) The file Creator
  239. Two optional parameters. Like FileName, the first parameter can be a file Type and will restrict the display to that type. The second is a text prompt string to appear at the top of the Dialog Box. Uses its own DLOG & DITL so you could customize further. 
  240.  
  241.  
  242. -- part contents for card part 7
  243. ----- text -----
  244.                       ChooseIcon & CustomFileName XFCN's
  245.  
  246.      These two XFCN's have been written to help in the clean management of "Finder Replacement" type stacks, but I'm sure they are useful for other HyperCard undertakings as well. The most thoughtful, artistic, and easy to use "Finder Replacement" I have seen to date is WorkStation 4.0 written by Debbie Iwatate (K.IWATATE on GEnie). It will be available shortly.
  247.      My XFCN's are entirely in the public domain and may be used any way you see fit. I always appreciate a little credit in the stacks. Note: These are beta versions, and while I have tried to eliminate bugs, please use them with caution, and let me know of any nasties.
  248.  
  249.                                           Oscar F. Hills
  250.                                   34 Maplewood Terrace
  251.                                     Hamden, CT 06514
  252.                                      (203) 287-1913
  253.                (CIS => 73317, 3005     GEnie => O.HILLS)
  254.  
  255. -- part contents for card part 9
  256. ----- text -----
  257. CustomFileName Version 2.0b1
  258.  
  259. 1) Bug fix: If you wish to display   ¬†¬†ALL file types AND use a prompt, ¬†¬†pass a null string for the first ¬†¬†parameter. This previously ¬†¬†caused NO file types to be ¬†¬†displayed (OOPS!)
  260.  
  261. 2) If you wish to rename the Open ¬†¬†button pass the name/command-¬†¬†key-eqivalent as a third ¬†¬†parameter,e.g., "Select/S"
  262.  
  263. See Sample Button #8 for Demo.